import { Column, Entity, Index } from 'typeorm'
import { BaseEntity } from './BaseEntity'

@Entity()
export class Student extends BaseEntity {

  @Column()
  public name!: string

  // 普通用户进入到小程序系统; 如果需要关联学生, 那么需要输入个人预留手机号和学生的编号
  @Column({ comment: '学生编号' })
  public studentNumber!: number

  @Column({ comment: '学生头像' })
  public avatar!: string

  @Column()
  public age!: number

  @Column({ comment: '关联用户的 id', nullable: true })
  @Index({ unique: true })
  public userId!: number

  @Column()
  public sex!: 0 | 1

  @Column({ comment: '身高' })
  public height!: number

  @Column({ comment: '体重' })
  public weight!: number

  @Column({ name: 'shoe_size', comment: '鞋码' })
  public shoeSize!: number

  @Column({ comment: '是否缴费', name: 'is_pay_tuition', default: 0 })
  public isPayTuition!: 0 | 1

  @Column({ comment: '学年类别', name: 'school_type', default: 0 })
  public schoolType!: 0 | 1

  @Column({ comment: '是否领取校服', name: 'is_gain_school_uniform', default: 0 })
  public isGainSchoolUniform!: 0 | 1

  @Column({ comment: '入学时间', name: 'join_school_time' })
  public joinSchoolTime!: string

  @Column({
    length: 12,
    name: 'father_name',
    comment: '父亲姓名',
    nullable: true,
  })
  public fatherName!: string

  @Column({
    length: 12,
    name: 'mother_name',
    comment: '母亲姓名',
    nullable: true,
  })
  public motherName!: string

  @Column({
    length: 12,
    comment: '在家监护人',
  })
  public guardian!: string

  @Column({
    name: 'mother_phone_number',
    comment: '母亲电话',
    nullable: true,
  })
  public motherPhoneNumber!: number

  @Column({
    name: 'father_phone_number',
    comment: '父亲电话',
    nullable: true,
  })
  public fatherPhoneNumber!: number

  @Column({
    length: 32,
    name: 'mother_wxchat',
    comment: '母亲微信',
    nullable: true,
  })
  public motherWxchatNumber!: string

  @Column({
    length: 32,
    name: 'father_wechat',
    comment: '父亲微信',
    nullable: true,
  })
  public fatherWechat!: string

  @Column({ default: '' })
  public address!: string

  @Column({
    type: 'text',
    comment: '特殊备注',
    nullable: true,
  })
  public remark!: string

}
